From: Pu Wen Date: Thu, 4 Apr 2019 13:47:40 +0000 (+0800) Subject: x86/domctl: Add Hygon Dhyana support X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~2105 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=87ca6a2a3b4d568f6e95f38db3d9702d1c876d23;p=xen.git x86/domctl: Add Hygon Dhyana support Add Hygon Dhyana support to update cpuid info for creating PV guest. Signed-off-by: Pu Wen Acked-by: Jan Beulich [Rebase over 0cd074144cb "x86/cpu: Renumber X86_VENDOR_* to form a bitmap"] Signed-off-by: Andrew Cooper --- diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 7c6b8093d2..c827790202 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -176,6 +176,7 @@ static int update_domain_cpuid_info(struct domain *d, break; case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: mask &= ((uint64_t)ecx << 32) | edx; /* @@ -220,7 +221,7 @@ static int update_domain_cpuid_info(struct domain *d, uint32_t eax = ctl->eax; uint32_t ebx = p->feat._7b0; - if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) + if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) ) mask &= ((uint64_t)eax << 32) | ebx; d->arch.pv.cpuidmasks->_7ab0 = mask; @@ -281,8 +282,11 @@ static int update_domain_cpuid_info(struct domain *d, if ( cpu_has_cmp_legacy ) ecx |= cpufeat_mask(X86_FEATURE_CMP_LEGACY); - /* If not emulating AMD, clear the duplicated features in e1d. */ - if ( p->x86_vendor != X86_VENDOR_AMD ) + /* + * If not emulating AMD or Hygon, clear the duplicated features + * in e1d. + */ + if ( !(p->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ) edx &= ~CPUID_COMMON_1D_FEATURES; switch ( boot_cpu_data.x86_vendor ) @@ -292,6 +296,7 @@ static int update_domain_cpuid_info(struct domain *d, break; case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: mask &= ((uint64_t)ecx << 32) | edx; /*